<template>
  <rx-layout>
    <div slot="center" style>
      <rx-fit>
        <div slot="toolheader" foldheader="true" foldbtn="false" border="false">
          <div class="table-operator">
            <rx-button alias="sysInterfaceClassificationAdd" :butn-icon="'plus'" :butn-type="'primary'" :show-no-right="true" @click="add">{{$ti18('rxList.newBtn','新建')}}</rx-button>
            <a-dropdown v-if="editEnable && selectedRowKeys.length > 0 || removeEnable && selectedRowKeys.length > 0">
              <a-button style="margin-left: 8px"> {{$ti18('rxList.moreBtn','更多')}} <a-icon type="down" /> </a-button>
              <a-menu slot="overlay">
                <a-menu-item key="1" v-if="editEnable && selectedRowKeys.length > 0" alias="sysInterfaceClassificationEdit" :butn-icon="'edit'"
                             :butn-type="'primary'" :show-no-right="false" @click="editOne"><a-icon type="user"  />{{$ti18('rxList.editBtn','编辑')}}</a-menu-item>
                <a-menu-item key="2" v-if="removeEnable && selectedRowKeys.length > 0" alias="sysInterfaceClassificationDelete" :butn-icon="'delete'" :butn-type="'danger'"
                             :show-no-right="false" @click="delByIds(selectedRowKeys)"><a-icon type="delete" />{{$ti18('rxList.delBtn','删除')}}</a-menu-item>
              </a-menu>
            </a-dropdown>
          </div>
          <span class="search-btn-box">
                <span class="search-btn" @click="searchshow"><i class="iconfont iconguolv"></i>{{$ti18('rxList.leachBtn','过滤')}}</span>
           </span>
        </div>
        <div slot="searchbar" btnalign="right"  v-if="fitSearch" @search="search" @cancel="cancel" @close="close">
          <a-form layout="vertical">
                <a-form-item :label="i18n('form.classificationName','分类名称')">
                    <a-input :placeholder="i18n('form.classificationName','分类名称','input')" v-model="queryParam.Q_CLASSIFICATION_NAME__S_LK"/>
                </a-form-item>
                <a-form-item :label="i18n('form.description','描述')">
                    <a-input :placeholder="i18n('form.description','描述','input')" v-model="queryParam.Q_DESCRIPTION__S_LK"/>
                </a-form-item>
                <a-form-item :label="i18n('form.projectId','项目ID')">
                    <a-input :placeholder="i18n('form.projectId','项目ID','input')" v-model="queryParam.Q_PROJECT_ID__S_LK"/>
                </a-form-item>
          </a-form>
        </div>
        <rx-grid
                ref="table"
                :allowRowSelect="true"
                :multiSelect="true"
                :columns="columns"
                :defaultPageSize="10"
                url="/api-system/system/core/sysInterfaceClassification/query"
                :queryParam="queryParam"
                data-field="result.data"
                :pageSizeOptions="['10','30','40']"
                id-field="classificationId"
                @selectChange="onSelectChange"
        >
        </rx-grid>
      </rx-fit>
    </div>
  </rx-layout>
</template>

<script>
  import SysInterfaceClassificationApi from '@/api/system/core/sysInterfaceClassification'
  import SysInterfaceClassificationEdit from './SysInterfaceClassificationEdit'
  import {BaseList,RxFit,RxGrid } from "@lowcode/jpaas-common-lib";
  export default {
    name: 'SysInterfaceClassificationList',
    mixins: [BaseList],
    components: {
      RxFit
    },
    data() {
      return {
        columns: [
          {
            title: this.$ti18('rxList.index','序号'),
            type: 'indexColumn',
            width: 100,
            dataIndex: 'serial',
            scopedSlots: {customRender: 'serial'}
          },
          {title: this.i18n('form.classificationName','分类名称'), dataIndex: 'classificationName', width: 100},
          {title: this.i18n('form.description','描述'), dataIndex: 'description', width: 100},
          {title: this.i18n('form.projectId','项目ID'), dataIndex: 'projectId', width: 100},
          {title: this.$ti18('rxList.action','操作'), width: 100, dataIndex: 'action', scopedSlots: {customRender: 'action'}}
        ],
        component:SysInterfaceClassificationEdit,
        comment:this.i18n('list.classTable','接口分类表'),
        widthHeight:['800px','600px'],
        fitSearch:false,
      }
    },
    methods:{
        i18n(name, text, key) {
            return this.$ti18(name, text, "sysInterfaceProject", key);
        },
      //fsad
      delById(ids){
        return SysInterfaceClassificationApi.del({ ids: ids.join(',') });
      },
      getListByParams(parameter){
        return SysInterfaceClassificationApi.query(parameter)
      },
      search(){
        this.$refs.table.loadData()
      },
      cancel(){
        this.resetSearch();
      },
      close(){
        //关闭按钮
        this.fitSearch = false ;
      },
    }
  }
</script>
<style scoped>

</style>

